<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>PlumGPT</title>
	<link rel="stylesheet" href="dist/stylesheets/chromagallery.min.css">
	<style type="text/css">
		body,html
		{ height: 100%; background-color: #191919; 		}
		.content
		{
			width: 100%;
			height: 100%;
			margin: 10px auto;
		}
		@media screen and (min-width: 980px) /* Desktop */ {
		  .content {
		    width: 70%;
		  }
		}
		.mygallery
		{
			margin: 25px 0;
		}
	</style>
</head>
<body>
	<article class="jq22-container">
		<div class="content">
			<div class="chroma-gallery mygallery">
			</div>
		</div>

	</article>

	<script src="../jquery-1.10.2.js"></script>
	<script src="dist/scripts/chromagallery.pkgd.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
            var search = window.location.search;
            search = search.substr(1);
            var params = {};
            search.split('&').forEach(function(item) {
                var parts = item.split('=');
                params[parts[0]] = parts[1];
            });
            $.ajax({
                type: "get",
                url: "/request/open/selected/his/works/"+params.wid,
                dataType: 'json',
                anyc: false,
                data: {},
                beforeSend: function(request) {
                    request.setRequestHeader("token",localStorage.getItem("token"));
                },
                success: function (data) {
                    $(".mygallery").chromaGallery
                    ({
                        color:'#000',
                        gridMargin:15,
                        maxColumns:5,
                        dof:true,
                        screenOpacity:0.8
                    });
                    if (data.code === 200) {
                        var gallery = $('.mygallery');
                        if (data.data === "-1"){
                            gallery.append($('<span style="color: #fff;">因作者设置隐私，个人作品暂不可见</span>'));
                        }else {
                            if (data.data.length === 0) {
                                gallery.append($('<span style="color: #fff;">暂无数据</span>'));
                            }else {
                                $.each(data.data, function(index, value) {
                                    var img = $('<img>').attr({
                                        'src': 'https://plumgpt.com'+value.imgBase,
                                        'alt': '作者： ' + value.userNickname,
                                        'data-largesrc': 'https://plumgpt.com'+value.imgBase
                                    });
                                    gallery.append(img);
                                });
                            }
                        }
                    }
                }
            })
		});

	</script>

</body>
</html>
